#include "shm.hpp"
#include "fifo.hpp"
#include <cstring>
int main() {
    Shm shm(path, proid, CREATE); // 构建共享内存
    shm.Attr(); // 打印相关的内容
    NamedFifo fifo(PATH, FILENAME); // 命名管道辅助共享内存的读写
    FileOper readfile(PATH, FILENAME); // 只读
    readfile.OpenForRead(); 
    char* mem = (char*)shm.VirtualAddr(); // 获取对应的映射
    while(true) {
        if(readfile.Wait()) {
             if (strcmp(mem, "q") == 0) break;
            printf("%s\n", mem);
        }else {
            break;
        }
    }
    readfile.Close();
    cout << "server end normal" << endl;
    return 0;
}